
/* 
 * File:   main.c
 * Author: christophe
 *
 * Created on 27 mars 2012, 14:14
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/*
 * 
 */
int main(int argc, char** argv)
{
    if (argc == 1)
    {
        printf("MODE TEST: \"ls -la\"  \"sort -r\" \"grep pi\" \"sort\" -d\n");
        int nb = 6;
        char **cmd = (char**) malloc(sizeof (char*) *1);
        cmd[0] = argv[0];
        cmd[1] = (char*) malloc(sizeof (char) *strlen("ls -la"));
        cmd[1] = "ls -la";
        cmd[2] = (char*) malloc(sizeof (char) *strlen("sort -r"));
        cmd[2] = "sort -r";
        cmd[3] = (char*) malloc(sizeof (char) *strlen("grep pi"));
        cmd[3] = "grep pi";
        cmd[4] = (char*) malloc(sizeof (char) *strlen("sort"));
        cmd[4] = "sort";
        cmd[5] = (char*) malloc(sizeof (char) *strlen("-d"));
        cmd[5] = "-d";
        start(nb, cmd);
    }
    else
        start(argc, argv);
    routine();

    return (EXIT_SUCCESS);
}

